From 1323aa4459004b9817f0cfbf4b59c31480d527cf Mon Sep 17 00:00:00 2001
From: Norbert Lange <nolange79@gmail.com>
Date: Fri, 1 Dec 2017 13:34:08 +0100
Subject: [PATCH] linux: provide canonicalize_file_name for all c libs except
 glibc

musl was not covered so far, and this library does not define a
macro for detection.
unless glibc is detected, a canonicalize_file_name implementation
will be provided.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 agent/tcf/framework/mdep.c | 2 +-
 agent/tcf/framework/mdep.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/agent/tcf/framework/mdep.c b/agent/tcf/framework/mdep.c
index 8aee811f..d38036be 100644
--- a/agent/tcf/framework/mdep.c
+++ b/agent/tcf/framework/mdep.c
@@ -1097,7 +1097,7 @@ char * canonicalize_file_name(const char * path) {
     return strdup(res);
 }
 
-#elif defined(__UCLIBC__)
+#elif defined(__UCLIBC__) || !defined(__GLIBC_)
 
 char * canonicalize_file_name(const char * path) {
     return realpath(path, NULL);
diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h
index f90f03f2..3e331383 100644
--- a/agent/tcf/framework/mdep.h
+++ b/agent/tcf/framework/mdep.h
@@ -292,7 +292,7 @@ extern int loc_clock_gettime(int, struct timespec *);
 
 #define O_BINARY 0
 
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__sun__)
+#if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__sun__)) | !defined (__GLIBC__)
 #  define O_LARGEFILE 0
 extern char ** environ;
 extern char * canonicalize_file_name(const char * path);
-- 
2.15.1

